package com.example.activityproject;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class OneActivity  extends AppCompatActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.one_activity_layout);
        String value = getIntent().getStringExtra("hello_key");
        Log.i("TAG","得到的value值为："+value);
        Log.i("TAG","对象："+this);
        Button to_one_act_bt = findViewById(R.id.to_one_act_bt);
        Button to_blue_act_bt = findViewById(R.id.to_blue_act_bt);
        to_one_act_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(OneActivity.this, OneActivity.class);
                OneActivity.this.startActivity(intent);

            }
        });
        to_blue_act_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(OneActivity.this, BlueAct.class);
                OneActivity.this.startActivity(intent);
            }
        });

    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        String msg = intent.getStringExtra("msg");
        Log.i("TAG","收到传回来的值："+msg);
    }
}
